/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.version.versionUpdate.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.version.versionUpdate.domain.VersionUpdate;
import com.seeyoui.kensite.bussiness.version.versionUpdate.persistence.VersionUpdateMapper;

/**
 * VersionUpdate
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-01-19
 */

@Service
public class VersionUpdateService extends BaseService {
	
	@Autowired
	private VersionUpdateMapper versionUpdateMapper;
	
	/**
	 * 根据项目名称查询数据
	 * @param projectName
	 * @return
	 */
	public VersionUpdate findVersionByProjectNameAndType(String projectName, String projectType){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("projectName", projectName);
		map.put("projectType", projectType);
		VersionUpdate versionUpdate = versionUpdateMapper.findVersionByProjectNameAndType(map);
		return versionUpdate;
	}

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public VersionUpdate findOne(String id) throws CRUDException{
		return versionUpdateMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param versionUpdate
	 * @return
	 * @throws CRUDException
	 */
	public List<VersionUpdate> findList(VersionUpdate versionUpdate) throws CRUDException {
		return versionUpdateMapper.findList(versionUpdate);
	}
	
	/**
	 * 查询所有数据集合
	 * @param versionUpdate
	 * @return
	 * @throws CRUDException
	 */
	public List<VersionUpdate> findAll(VersionUpdate versionUpdate) throws CRUDException {
		return versionUpdateMapper.findAll(versionUpdate);
	}
	
	/**
	 * 查询数据总数
	 * @param versionUpdate
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(VersionUpdate versionUpdate) throws CRUDException {
		return versionUpdateMapper.findTotal(versionUpdate);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param versionUpdate
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(VersionUpdate versionUpdate) throws CRUDException {
		return versionUpdateMapper.findExTotal(versionUpdate);
	}
	
	/**
	 * 数据新增
	 * @param versionUpdate
	 * @throws CRUDException
	 */
	public void save(VersionUpdate versionUpdate) throws CRUDException{
		versionUpdate.preInsert();
		versionUpdateMapper.save(versionUpdate);
	}
	
	/**
	 * 数据修改
	 * @param versionUpdate
	 * @throws CRUDException
	 */
	public void update(VersionUpdate versionUpdate) throws CRUDException{
		versionUpdate.preUpdate();
		versionUpdateMapper.update(versionUpdate);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		versionUpdateMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param versionUpdate
	 * @throws CRUDException
	 */
	public void remove(VersionUpdate versionUpdate) throws CRUDException{
		versionUpdate.preUpdate();
		versionUpdateMapper.remove(versionUpdate);			
	}
	
}